//package com.service.impl;
//
//import com.mapper.WorkstationMapper;
//import com.pojo.Workstation;
//import com.pojo.WorkstationStatus;
//import com.service.WorkstationService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import java.util.List;
//
//@Service
//public class WorkstationServiceImpl implements WorkstationService {
//    @Autowired
//    private WorkstationMapper workstationMapper;
//
//    // ---------------------- 基础操作 ----------------------
//    @Override
//    public void add(Workstation workstation) {
//        workstationMapper.insert(workstation);
//    }
//
//    @Override
//    public List<Workstation> listByFloor(Integer floorId) {
//        return workstationMapper.selectByFloorId(floorId);
//    }
//
//    // ---------------------- 更新与查询 ----------------------
//    @Override
//    public void updateStatus(Integer id, String status) {
//        Workstation workstation = workstationMapper.selectById(id);
//        if (workstation == null) {
//            throw new RuntimeException("工位不存在");
//        }
//        // 校验状态合法性
//        try {
//            WorkstationStatus statusEnum = WorkstationStatus.valueOf(status);
//            workstation.setStatus(statusEnum);
//            workstationMapper.updateById(workstation);
//        } catch (IllegalArgumentException e) {
//            throw new RuntimeException("无效的状态值: " + status);
//        }
//    }
//
//    @Override
//    public String getModelIdentifier(Integer id) {
//        Workstation workstation = workstationMapper.selectById(id);
//        if (workstation == null) {
//            throw new RuntimeException("工位不存在");
//        }
//        return workstation.getModelIdentifier();
//    }
//}